{include file="public/header"}
</head>
<body>
	<header>
		<a href="{:url('Cate/category')}">
			<i class="icon-caidan2 icon iconfont"></i>
		</a>
		<form action="{:url('cate/list')}" id="F" method="get">
			<input type="text" name="key" placeholder="输入要搜索的内容">
			<a href="javascript:F.submit();"><i class="icon-sousuo2 icon iconfont"></i></a>
		</form>
		<a href="{:url('Address/Address')}">
			{if isset($headImg['head_img']) && !empty($headImg['head_img'])}
			<img src="{$headImg['head_img']}" style="height: 30px;width: 30px;border-radius: 50px;" alt="">
			{else/}
			<i class="icon-huiyuanzhongxinyonghutouxiang icon iconfont"></i>
			{/if}
		</a>
	</header>
	<div class="main">
		<section class="banner">
			<img src="/static/imgs/banner.jpg" alt="">
		</section>
		<nav>
			{foreach $cate as $v}
			<a href="{:url('Cate/category',['id'=>$v['id']])}"><img src="/static/{$v['pic']}" alt=""><span>{$v['name']}</span></a>
			{/foreach}
			<a href="{:url('Cate/category')}"><img src="/static/imgs/d4.png" alt=""><span>全部分类</span></a>
		</nav>
		<section class="plist">
			<h1>
				<i></i><em>秒杀</em><span>商品</span><i></i>
			</h1>
			<ul>
				{foreach $limit as $v}
				<li>
					<img src="/static/{$v['photo']}" alt="" style="width: 100px;height: 100px;">
					<span class="pname">{$v['name']}</span>
					<span class="price">¥{$v['price']}</span>
					{if $time>=$v['addtime'] && $time<=$v['endtime'] && $v['num']>0}
					<a href="{:url('Good/goodLimit',['id'=>$v['id']])}" class="pay">立即购买</a>
					{elseif $time>$v['endtime']/}
					<a href="#" disabled="true" style="background-color: #8a8c96" class="pay">秒杀结束</a>
					{elseif $time<=$v['addtime']/}
					<a href="#" disabled="true" style="background-color: #8a8c96" class="pay">尚未开始</a>
					{elseif $time>=$v['addtime'] && $time<=$v['endtime'] && $v['num']==0}
					<a href="#" disabled="true" style="background-color: #8a8c96" class="pay">商品售空</a>
					{/if}
					<input type="hidden" name="" id="addtime" value="{:date('Y-m-d H:i:s',$v['addtime'])}">
					<input type="hidden" id="pid" value="{$v['pid']}">
				</li>
				{/foreach}
			</ul>
		</section>
		<section class="plist">
			<h1>
				<i></i><em>推荐</em><span>商品</span><i></i>
			</h1>
			<ul>
				{foreach $show as $v}
				<li>
					<img src="/static/{$v['photo_x']}" alt="" style="width: 100px;height: 100px;">
					<span class="pname">{$v['name']}</span>
					<span class="price">¥{$v['price']}</span>
					<a href="{:url('Good/goodsInfo',['id'=>$v['id']])}" class="pay">立即购买</a>
				</li>
				{/foreach}
			</ul>
		</section>
		<section class="plist">
			<h1>
				<i></i><em>热门</em><span>商品</span><i></i>
			</h1>
			<ul>
				{foreach $hot as $v}
				<li>
					<img src="/static/{$v['photo_x']}" alt="" style="width: 100px;height: 100px;">
					<span class="pname">{$v['name']}</span>
					<span class="price">¥{$v['price']}</span>
					<a href="{:url('Good/goodsInfo',['id'=>$v['id']])}" class="pay">立即购买</a>
				</li>
				{/foreach}
			</ul>
		</section>
	</div>
	{include file="public/footer"}
	<script>
        // $(function () {
        //     function Timer() {
        //         var pid = $('#pid').val();
        //         var date = new Date();
        //         var tdate = new Date($("#addtime").val());
        //         var cha = (tdate-date)/86400000;
        //         var year = Math.floor(cha/365);
        //         var yue = Math.floor(((cha/365)-year)*12);
        //         var ri = Math.floor(((((cha/365)-year)*12)-yue)*30);
        //         var hours = Math.floor(((((((cha/365)-year)*12)-yue)*30)-ri)*24);
        //         var fens = Math.floor(((((((((cha/365)-year)*12)-yue)*30)-ri)*24)-hours)*60);
        //         var miao = Math.floor(((((((((((cha/365)-year)*12)-yue)*30)-ri)*24)-hours)*60)-fens)*60);
        //         var minmiao = Math.floor(((((((((((((cha/365)-year)*12)-yue)*30)-ri)*24)-hours)*60)-fens)*60)-miao)*1000);
        //         $("#ms").html(" "+hours+"时"+fens+"分"+miao+"秒");
        //
        //         if (cha<0){
        //             console.log(pid);
        //             clearInterval(time);
        //             $("#ms").html('立即购买');
        //            	$("#ms").css('background-color',"#ff6569");
        //             $("#ms").prop('href',"../good/goodLimit?id="+pid);
        //         }
        //     }
        //
        //     var time = setInterval(Timer,1000);
        // })







	</script>
</body>
</html>